<?php
use yii\helpers\ArrayHelper;
use common\library\htmlHelper;
use yii\helpers\Url;

?>
<!--<form class="layui-form" action="/cake-class/edit">-->
<div class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-inline">
            <div class="site-demo-upload">
                <img id="logo_view"
                     src="<?php if (isset($info['avatar']) && !empty($info['avatar'])) echo HTTP_DOMAIN_ASSETS . '/' . $info['avatar']; ?>">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">当前角色</label>
        <div class="layui-inline">
            <select name="" disabled="disabled" class="layui-select">
                <option value="">全部</option>
                <?php
                foreach ($roleList as $key => $value) {
                    ?>
                    <option value="<?= $key ?>"  <?= $key === $info['role'] ? 'selected="selected"' : '' ?>><?= $value ?></option>
                    <?php
                }
                ?>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'nickname') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">店铺名称</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'store_name') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'mobile') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">点赞量</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'like_num') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">收藏量</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'collection_num') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">点击量</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'hit_num') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">作品量</label>
        <div class="layui-input-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'works_num') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地区</label>
        <div class="layui-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'pca_info') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详情地址</label>
        <div class="layui-inline">
            <input type="text" name="" value="<?= ArrayHelper::getValue($info, 'address') ?>"
                   class="layui-input layui-disabled" disabled="disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">微信二维码</label>
        <div class="layui-input-inline">
            <div class="site-demo-upload">
                <img id="logo_view"
                     src="<?php if (isset($info['qrcode']) && !empty($info['qrcode'])) echo HTTP_DOMAIN_ASSETS . '/' . $info['qrcode']; ?>">
            </div>
        </div>
    </div>
    <form class="layui-form" action="/member/application-edit">


        <div class="layui-form-item">
            <label class="layui-form-label">审核</label>
            <div class="layui-input-block">
                <input type="radio" name="under_review" value="1" title="待审核" <?php if($info['under_review'] == 1):?>checked<?php endif;?> >
                <input type="radio" name="under_review" value="2" title="通过" <?php if($info['under_review'] == 2):?>checked<?php endif;?>>
                <input type="radio" name="under_review" value="-1" title="驳回" <?php if($info['under_review'] == -1):?>checked<?php endif;?>>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">理由</label>
            <div class="layui-input-inline">
                <textarea name="reason" rows="5" placeholder="请输入驳回/通过理由" class="layui-textarea"><?= ArrayHelper::getValue($info, 'reason') ?></textarea>
            </div>
        </div>
        <input type="hidden" name="<?= Yii::$app->request->csrfParam ?>" value="<?= Yii::$app->request->csrfToken ?>">
        <input type="hidden" name="member_id" value="<?= ArrayHelper::getValue($info, 'member_id') ?>">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submit-btn">操作</button>
            </div>
        </div>
    </form>

</div>
<!--</form>-->
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            form = layui.form();

        form.on('submit(submit-btn)', function (data) {
            var loading = layer.load(0, {shade: <?=Yii::$app->params['layui_shade']?>, time: <?=Yii::$app->params['layui_time']?>});
            $.post(data.form.action, data.field, function (rs) {
                layer.msg(rs.msg);
                if (rs.code === 0) {
                    setTimeout(function () {
                        window.location.href = rs.data.redirect;
                    }, <?=Yii::$app->params['layui_set_timeout']?>);
                }
                layer.close(loading);
            }, 'json');
            return false;
        });

    });
</script>